//
//  BrandTableViewCell.swift
//  Pods
//
//  Created by eme on 2017/3/31.
//
//

import UIKit
import RickonCore

class BrandTableViewCell: UITableViewCell {
    
    @IBOutlet weak var clicked_ImageView: UIImageView!     //点击图片
    @IBOutlet weak var brandHeader_ImageView: UIImageView! //品牌图片
    @IBOutlet weak var brandName_Label: UILabel!           //品牌名称
    @IBOutlet weak var collectNumber: UILabel!             //收藏人数

    @IBOutlet weak var leftWithLabel: NSLayoutConstraint!
    
    @IBOutlet weak var lineView: UIView!
    
    var item:CollectBrandModel?{
        didSet{
            if let model = item{
                self.brandName_Label.text = model.brname
                
                self.collectNumber.text = "\(model.count)人已收藏"
                
                self.brandHeader_ImageView.setUrlImage(model.brlogourl)
            }
        }
    }
    var isEditor:Bool?{
        didSet{
            if let editor = isEditor{
                if editor == false{
                    
                    item!.isclicked = 0
                    self.clicked_ImageView.isHidden = true
                    self.leftWithLabel.constant = -17
                    
                }else{
                    self.clicked_ImageView.isHidden = false
                    self.leftWithLabel.constant = 6
                    
                    if item!.isclicked == 0{
                        
                        
                        self.clicked_ImageView.image = UIImage(named: "not clicked", in: SansaCore.bundle, compatibleWith: nil)
                        
                    }else{
                        
                        self.clicked_ImageView.image = UIImage(named: "The selected", in: SansaCore.bundle, compatibleWith: nil)
                        
                    }
                }
            }
        }
        
    }
    

    
    override func awakeFromNib() {
        super.awakeFromNib()
        lineView.backgroundColor = Theme.v.separate_Line
        self.brandName_Label.normal_fontSize(16)
        self.collectNumber.normal_fontSize(14)
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
